package com.tanhua.server.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.common.mapper.UserInfoMapper;
import com.tanhua.common.pojo.UserInfo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
public class UserInfoService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    public UserInfo queryUserInfoByUserId(Long userId) {
        QueryWrapper<UserInfo> queryWapper = new QueryWrapper<>();
        queryWapper.eq("user_id", userId);
        UserInfo userInfo = userInfoMapper.selectOne(queryWapper);
        return userInfo;
    }

    public List<UserInfo> queryUserInfoList(QueryWrapper<UserInfo> queryWrapper) {
       return userInfoMapper.selectList(queryWrapper);
    }

    // 根据用户id的集合查询用户列表
    public List<UserInfo> queryUserInfoByUserIdList(Collection<?> userId) {
        QueryWrapper<UserInfo> queryWapper = new QueryWrapper<>();
        queryWapper.in("user_id", userId);
        return queryUserInfoList(queryWapper);
    }

}
